<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>右键菜单集成 - 原型图</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            margin: 0;
            padding: 40px;
            min-height: 100vh;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            background: white;
            border-radius: 20px;
            padding: 40px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
        }

        h1 {
            color: #333;
            text-align: center;
            margin-bottom: 40px;
            font-size: 2.5em;
            font-weight: 300;
        }

        .demo-section {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 40px;
            margin-bottom: 40px;
        }

        .demo-card {
            background: #f8f9fa;
            border-radius: 15px;
            padding: 30px;
            border: 2px solid #e9ecef;
        }

        .demo-title {
            font-size: 1.5em;
            color: #333;
            margin-bottom: 25px;
            font-weight: 600;
            text-align: center;
        }

        .webpage-mockup {
            background: white;
            border: 2px solid #e0e0e0;
            border-radius: 10px;
            padding: 20px;
            margin-bottom: 20px;
            position: relative;
        }

        .webpage-header {
            background: #f5f5f5;
            padding: 10px;
            border-radius: 5px;
            margin-bottom: 15px;
            font-size: 0.9em;
            color: #666;
        }

        .content-area {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
        }

        .media-element {
            border: 2px dashed #ddd;
            border-radius: 8px;
            padding: 20px;
            text-align: center;
            position: relative;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .media-element:hover {
            border-color: #2196F3;
            background: #f0f8ff;
        }

        .media-element.image {
            background: linear-gradient(45deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
        }

        .media-element.video {
            background: linear-gradient(45deg, #a8edea 0%, #fed6e3 100%);
        }

        .media-icon {
            font-size: 2em;
            margin-bottom: 10px;
        }

        .media-label {
            font-size: 0.9em;
            color: #333;
            font-weight: 500;
        }

        .context-menu {
            position: absolute;
            background: white;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
            padding: 8px 0;
            min-width: 200px;
            z-index: 1000;
            animation: menuSlideIn 0.2s ease-out;
        }

        @keyframes menuSlideIn {
            from {
                opacity: 0;
                transform: scale(0.95) translateY(-10px);
            }

            to {
                opacity: 1;
                transform: scale(1) translateY(0);
            }
        }

        .menu-item {
            padding: 10px 16px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 0.9em;
            color: #333;
            transition: background 0.2s ease;
        }

        .menu-item:hover {
            background: #f5f5f5;
        }

        .menu-item.download {
            color: #2196F3;
            font-weight: 500;
        }

        .menu-item.download-all {
            color: #4CAF50;
            font-weight: 500;
        }

        .menu-separator {
            height: 1px;
            background: #e0e0e0;
            margin: 4px 0;
        }

        .menu-item.disabled {
            color: #ccc;
            cursor: not-allowed;
        }

        .menu-item.disabled:hover {
            background: transparent;
        }

        .features-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 30px;
            margin-top: 40px;
        }

        .feature-card {
            background: #f8f9fa;
            border-radius: 15px;
            padding: 25px;
            border: 2px solid #e9ecef;
        }

        .feature-title {
            font-size: 1.3em;
            color: #333;
            margin-bottom: 15px;
            font-weight: 600;
        }

        .feature-list {
            list-style: none;
            padding: 0;
        }

        .feature-list li {
            padding: 8px 0;
            color: #555;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .feature-list li::before {
            content: "✓";
            color: #4CAF50;
            font-weight: bold;
        }

        .interaction-demo {
            background: #2c3e50;
            border-radius: 15px;
            padding: 30px;
            margin-top: 40px;
            color: white;
        }

        .interaction-title {
            font-size: 1.5em;
            margin-bottom: 20px;
            text-align: center;
        }

        .interaction-steps {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
        }

        .step-item {
            background: rgba(255, 255, 255, 0.1);
            border-radius: 10px;
            padding: 20px;
            text-align: center;
        }

        .step-number {
            background: #3498db;
            color: white;
            width: 30px;
            height: 30px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 15px;
            font-weight: bold;
        }

        .step-title {
            font-weight: 600;
            margin-bottom: 10px;
        }

        .step-description {
            font-size: 0.9em;
            opacity: 0.9;
            line-height: 1.4;
        }

        .specifications {
            background: #f8f9fa;
            border-radius: 15px;
            padding: 30px;
            margin-top: 40px;
        }

        .spec-title {
            font-size: 1.3em;
            color: #333;
            margin-bottom: 20px;
            font-weight: 600;
        }

        .spec-list {
            list-style: none;
            padding: 0;
        }

        .spec-list li {
            padding: 10px 0;
            border-bottom: 1px solid #e9ecef;
            color: #555;
        }

        .spec-list li:last-child {
            border-bottom: none;
        }

        .spec-list li::before {
            content: "✓";
            color: #4CAF50;
            font-weight: bold;
            margin-right: 10px;
        }
    </style>
</head>

<body>
    <div class="container">
        <h1>右键菜单集成 - 原型图</h1>

        <div class="demo-section">
            <div class="demo-card">
                <div class="demo-title">🖼️ 图片右键菜单</div>
                <div class="webpage-mockup">
                    <div class="webpage-header">网页内容区域</div>
                    <div class="content-area">
                        <div class="media-element image" onclick="showImageMenu(event)">
                            <div class="media-icon">🖼️</div>
                            <div class="media-label">产品图片</div>
                        </div>
                        <div class="media-element image" onclick="showImageMenu(event)">
                            <div class="media-icon">🖼️</div>
                            <div class="media-label">横幅图片</div>
                        </div>
                    </div>
                </div>

                <div class="context-menu" id="imageMenu" style="display: none;">
                    <div class="menu-item download">
                        📥 下载此图片
                    </div>
                    <div class="menu-item">
                        🔍 在新标签页中查看
                    </div>
                    <div class="menu-item">
                        📋 复制图片地址
                    </div>
                    <div class="menu-separator"></div>
                    <div class="menu-item download-all">
                        📥 下载页面所有图片
                    </div>
                    <div class="menu-item">
                        ⚙️ 下载设置
                    </div>
                </div>
            </div>

            <div class="demo-card">
                <div class="demo-title">🎥 视频右键菜单</div>
                <div class="webpage-mockup">
                    <div class="webpage-header">网页内容区域</div>
                    <div class="content-area">
                        <div class="media-element video" onclick="showVideoMenu(event)">
                            <div class="media-icon">🎥</div>
                            <div class="media-label">产品视频</div>
                        </div>
                        <div class="media-element video" onclick="showVideoMenu(event)">
                            <div class="media-icon">🎥</div>
                            <div class="media-label">演示视频</div>
                        </div>
                    </div>
                </div>

                <div class="context-menu" id="videoMenu" style="display: none;">
                    <div class="menu-item download">
                        📥 下载此视频
                    </div>
                    <div class="menu-item">
                        🎬 选择清晰度
                    </div>
                    <div class="menu-item">
                        📋 复制视频地址
                    </div>
                    <div class="menu-separator"></div>
                    <div class="menu-item download-all">
                        📥 下载页面所有视频
                    </div>
                    <div class="menu-item">
                        ⚙️ 下载设置
                    </div>
                </div>
            </div>
        </div>

        <div class="interaction-demo">
            <div class="interaction-title">用户交互流程</div>
            <div class="interaction-steps">
                <div class="step-item">
                    <div class="step-number">1</div>
                    <div class="step-title">右键点击</div>
                    <div class="step-description">用户在图片或视频上右键点击，触发上下文菜单</div>
                </div>
                <div class="step-item">
                    <div class="step-number">2</div>
                    <div class="step-title">菜单显示</div>
                    <div class="step-description">插件检测到右键事件，显示自定义下载菜单</div>
                </div>
                <div class="step-item">
                    <div class="step-number">3</div>
                    <div class="step-title">选择操作</div>
                    <div class="step-description">用户选择下载选项，插件开始处理下载任务</div>
                </div>
                <div class="step-item">
                    <div class="step-number">4</div>
                    <div class="step-title">下载完成</div>
                    <div class="step-description">文件下载到用户指定的文件夹，显示完成通知</div>
                </div>
            </div>
        </div>

        <div class="features-grid">
            <div class="feature-card">
                <div class="feature-title">右键菜单功能</div>
                <ul class="feature-list">
                    <li>单个文件下载选项</li>
                    <li>批量下载页面所有媒体</li>
                    <li>文件信息查看功能</li>
                    <li>复制文件地址功能</li>
                    <li>下载设置快速访问</li>
                    <li>清晰度选择（视频）</li>
                </ul>
            </div>

            <div class="feature-card">
                <div class="feature-title">用户体验</div>
                <ul class="feature-list">
                    <li>直观的图标和文字说明</li>
                    <li>平滑的动画效果</li>
                    <li>智能的菜单定位</li>
                    <li>快捷键支持</li>
                    <li>上下文感知功能</li>
                    <li>错误状态处理</li>
                </ul>
            </div>

            <div class="feature-card">
                <div class="feature-title">技术实现</div>
                <ul class="feature-list">
                    <li>Chrome Context Menus API</li>
                    <li>动态菜单项创建</li>
                    <li>权限管理和验证</li>
                    <li>跨域资源处理</li>
                    <li>文件类型检测</li>
                    <li>下载队列管理</li>
                </ul>
            </div>
        </div>

        <div class="specifications">
            <div class="spec-title">右键菜单设计规格</div>
            <ul class="spec-list">
                <li>菜单样式：遵循Chrome原生菜单设计规范</li>
                <li>定位逻辑：智能定位，避免超出视窗边界</li>
                <li>动画效果：淡入淡出，提升用户体验</li>
                <li>响应时间：菜单显示延迟不超过100ms</li>
                <li>键盘支持：支持Tab键导航和Enter键确认</li>
                <li>无障碍设计：支持屏幕阅读器和键盘操作</li>
                <li>多语言支持：根据浏览器语言显示对应文本</li>
                <li>权限检查：根据当前页面权限显示可用选项</li>
            </ul>
        </div>
    </div>

    <script>
        function showImageMenu(event) {
            event.preventDefault();
            const menu = document.getElementById('imageMenu');
            const rect = event.target.closest('.media-element').getBoundingClientRect();

            menu.style.display = 'block';
            menu.style.left = rect.right + 10 + 'px';
            menu.style.top = rect.top + 'px';

            // 隐藏其他菜单
            document.getElementById('videoMenu').style.display = 'none';
        }

        function showVideoMenu(event) {
            event.preventDefault();
            const menu = document.getElementById('videoMenu');
            const rect = event.target.closest('.media-element').getBoundingClientRect();

            menu.style.display = 'block';
            menu.style.left = rect.right + 10 + 'px';
            menu.style.top = rect.top + 'px';

            // 隐藏其他菜单
            document.getElementById('imageMenu').style.display = 'none';
        }

        // 点击其他地方隐藏菜单
        document.addEventListener('click', function (event) {
            if (!event.target.closest('.context-menu') && !event.target.closest('.media-element')) {
                document.getElementById('imageMenu').style.display = 'none';
                document.getElementById('videoMenu').style.display = 'none';
            }
        });
    </script>
</body>

</html>